<?php
class Admin extends Mclog {

    public $user = null;

    public function __construct() {
        parent::__construct();
        $this->isLogin();
    }

    private function isLogin() {
        if( 'login' == mc_request('c') ){
            return;
        }
        $user = mc_model( 'user' );
        if ( !$this->user = $user->is_login() ) {
            $this->redirect( $this->mc_url( 'login', 'index', array( 'referer' => mc_request( 'referer', '' ) ) ) );
        }
    }

    /**
     * 错误提示程序
     *
     * @param $msg     错误提示需要的相关信息
     * @param $url     跳转地址
     * @param $delay   延迟时间
     */
    public function error( $msg = null, $url = null, $delay = 5 ) {
        if ( mc_request( 'ajax' ) ) exit( $msg );
        if ( $msg == null ) $msg = "请求参数错误!" . mc_server( 'REQUEST_URI' );
        if ( $url == null ) $url = $this->mc_url( mc_request( 'c' ) );
        include $this->display( "msg" );
        exit;
    }

    public function success() {

    }
}